/*
 *  Copright: 2008 Philipp Leitner, Distributed Systems Group,
 *            TU Wien, leitner@infosys.tuwien.ac.at
 *
 *  This file is part of DAIOS.
 *
 *  DAIOS is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as
 *  published by the Free Software Foundation.
 * 
 *  DAIOS is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with DAIOS.  If not, see
 *  <http://www.gnu.org/licenses/>.
 * 
 */

package at.ac.tuwien.infosys.dsg.daios.wsdl.interfaces;

import javax.xml.namespace.QName;

import org.apache.xmlbeans.SchemaType;

import at.ac.tuwien.infosys.dsg.daios.framework.structs.DaiosMessage;

/**
 * Interface defining a Daios WSDL Type. The semantics
 * of this interface is different for RPC and document style:
 * a WSDL Type in RPC style will usually be a XML Schema type
 * definition; a Type in document style will be a global
 * element definition (often with an anonymous inline type
 * definition).
 * 
 * @author philipp
 *
 */
public interface IWSDLType {
	
	/**
	 * Get the qualified (element) name of the type. Null if there is no
	 * element name (e.g. for global type definitions).
	 * 
	 * @return The QName of the element defining this type.
	 */
	public QName getName();

	/**
	 * Get the SchemaType as defined by XMLBeans that underlies this IWSDLType.
	 * 
	 * @return The XMLBeans SchemaType.
	 */
	public SchemaType getType();
	
	/**
	 * Get the qualified (element) name of the type. Null if there is no
	 * element name (e.g. for global type definitions).
	 * 
	 * @return The QName of the element defining this type.
	 */
	public QName getTypeName();
	
	
	/**
	 * Get the 'content model' of this type, i.e. the sequence of subtypes that
	 * defines this type.
	 * 
	 * @return The sequence of subtypes IWSDLType[] .
	 */
	public IWSDLType[] getSequence();
	
	/**
	 * Get the <i>structure</i> of this type. The structure is
	 * the Daios Message with a structural distance of exactly 0.
	 * 
	 * @return The structure of this type.
	 */
	public DaiosMessage getStructure();
	
	/**
	 * Calculate the distance between this type (i.e. the structure
	 * of this type) and a given Daios message.
	 * 
	 * @param message The given Daios message.
	 * @return The distance between the structure of this type
	 * and the given Daios message.
	 */
	public int calculateDistanceToMessage(DaiosMessage message);
	
}
